// @algorithm @lc id=100273 lang=cpp
// @title yong-liang-ge-zhan-shi-xian-dui-lie-lcof
#include <iostream>
#include <stack>
using namespace std;
class CQueue {
public:
    stack<int> s1;
    stack<int> s2;
    CQueue() {}

    void appendTail(int value) {
        s1.push(value);
    }

    int deleteHead() {
        int ans;
        if (s1.empty() && s2.empty()) {
            return -1;
        }
        if (!s2.empty()) {
            ans = s2.top();
            s2.pop();
            return ans;
        }
        while (!s1.empty()) {
            s2.push(s1.top());
            s1.pop();
        }
        ans = s2.top();
        s2.pop();
        return ans;
    }
};